package com.zzt.ioc.controller;

import com.zzt.ioc.config.UserConfig;
import com.zzt.ioc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * Description
 * User: panda
 * Date: 2025-02-21
 * Time: 17:21
 */
@Controller
public class HelloController {

    //属性注入
    @Autowired
    private UserService us;

    @Autowired
    private UserConfig userConfig;

//
//    //构造方法注入
//    private UserService us;
//
//    private UserConfig userConfig;
//
////    public HelloController() {
////    }
//
//
//    public HelloController(UserService us) {
//        this.us = us;
//    }
//
//    @Autowired
//    public HelloController(UserService us, UserConfig userConfig) {
//        this.us = us;
//        this.userConfig = userConfig;
//    }

//    //setter 方法注入
//    private UserService us;
//
//    private UserConfig userConfig;
//
//    @Autowired
//    public void setUs(UserService us) {
//        this.us = us;
//    }
//    @Autowired
//    public void setUserConfig(UserConfig userConfig) {
//        this.userConfig = userConfig;
//    }

    public void print(){
        System.out.println("do Controller");
        System.out.println(us);
        us.print();
        userConfig.print();
    }
}
